<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <div th:include="common/css::css"></div>
</head>
<body>
<!-- loader Start -->
<div id="loading" style="display: none;">
  <div id="loading-center">
  </div>
</div>
<!-- loader END -->
<!-- Wrapper Start -->
<div class="wrapper">
  <div th:include="common/top :: top"></div>
  <div th:include="common/left :: left(activeUrl='course',Url='course/list')"></div>
  <div id="content-page" class="content-page">
    <div class="container-fluid">
      <div class="row">
        <div class="col-sm-12">
          <div class="iq-card">
            <div class="iq-card-header d-flex justify-content-between">
              <div class="iq-header-title">
                <h4 class="card-title">课程信息</h4>
              </div>
            </div>
            <div class="iq-card-body">
              <p th:if="${major=='总专业'}">总专业页面的信息无法编辑与新增</p>
              <nav class="iq-sidebar-menu" style="width: 200px;float: left">
                <ul id="iq-sidebar-toggle" class="iq-menu">
                  <li>
                    <a href="#map-page" class="iq-waves-effect collapsed" data-toggle="collapse" aria-expanded="false"><i class="ri-map-pin-user-line"></i><span th:text="${major}"></span><i class="ri-arrow-right-s-line iq-arrow-right"></i></a>
                    <ul id="map-page" class="iq-submenu collapse" data-parent="#iq-sidebar-toggle">
                      <li><a th:href="@{/course/list(major='总专业')}">总专业</a></li>
                      <li><a th:href="@{/course/list(major='软件工程')}">软件工程</a></li>
                      <li><a th:href="@{/course/list(major='计算机科学与技术')}">计算机科学与技术</a></li>
                    </ul>
                  </li>
                </ul>
              </nav>
              <button th:if="${major!='总专业'}" style="float: right" type="button" class="btn mb-3 btn-primary rounded-pill"><i class="ri-bill-fill"></i><a style="color: white" th:href="@{/course/add(major=${major})}">添加</a></button>
              <div class="table-responsive">
                <table id="datatable" class="table table-striped table-bordered">
                  <thead>
                  <tr>
                    <th>课程号</th>
                    <th>课程名称</th>
                    <th>学分</th>
                    <th>学时</th>
                    <th th:if="${major!='总专业'}">操作</th>
                  </tr>
                  </thead>
                  <tbody>
                  <tr th:each="cou:${CouList}">
                    <td th:text="${cou.couId}"></td>
                    <td th:text="${cou.couName}"></td>
                    <td th:text="${cou.couGrade}"></td>
                    <td th:text="${cou.couTime}"></td>
                    <td th:if="${major!='总专业'}">
                      <a style="margin-bottom: 0;height: 40px;"class="iq-icons-list" th:href="@{/course/editor(couId=${cou.couId})}"><i class="las la-edit"></i>编辑</a>
                      <a style="margin-bottom: 0;height: 40px;"class="iq-icons-list" th:href="@{/course/delete(couId=${cou.couId})}"><i class="ion-trash-b"></i>删除</a>
                    </td>
                  </tr>
                  </tbody>
                  <tfoot>
                  </tfoot>
                </table>
                <div style="float: right" class="col-md-6" th:if="${pageInfo!=null}">
                  <nav aria-label="Page navigation example">
                    <ul class="pagination justify-content-end mb-0">
                      <li class="page-item">
                        <a class="page-link" th:href="@{/course/list(pageNum=${pageInfo.prePage})}">Previous</a>
                      </li>
                      <li th:each="page:${pageInfo.getNavigatepageNums()}" th:class="${pageInfo.pageNum==page?'page-item active':''}">
                        <a class="page-link" th:href="@{/course/list(pageNum=${page})}">[[${page}]]</a>
                      </li>
                      <li class="page-item">
                        <a class="page-link" th:href="@{/course/list(pageNum=${pageInfo.nextPage})}">Next</a>
                      </li>
                    </ul>
                  </nav>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>

    </div>
  </div>
</div>
<div th:include="common/js::js"></div>
</body>
</html>